import express from 'express'
const router = express.Router()
import {body, param} from 'express-validator'
import {getArticleList, saveArticle, updateArticle, delArticel} from '../services/articleServ'
router.get('/getArticleList', getArticleList)
    .post('/saveArticle', 
        body('cover').not().isEmpty(),
        body('isVisible').not().isEmpty(), 
        body('md').not().isEmpty(),
        body('mdTitle').not().isEmpty(),
        body('tags').not().isEmpty(),
        saveArticle)
    .put('/updateArticle/:id', 
        param('id').not().isEmpty(),
        body('cover').not().isEmpty(),
        body('isVisible').not().isEmpty(), 
        body('md').not().isEmpty(),
        body('mdTitle').not().isEmpty(),
        body('tags').not().isEmpty(),
        updateArticle)
    .delete('/delArticle/:id', delArticel)
export default router